// Package region 模型
package region

import (
	// "gitee.com/sweetsunnyflower/carpooling-server-go/pkg/logger"
	"gitee.com/sweetsunnyflower/carpooling-server-go/app/models"
	"gitee.com/sweetsunnyflower/carpooling-server-go/pkg/database"
)

// 开通区域表
type Region struct {
	models.BaseModel
	Name string `gorm:"type:varchar(255)" db:"name" json:"name" form:"name"`
	models.CommonTimestampsField
}

func (region *Region) Create() {
	database.DB.Create(&region)
}

func (region *Region) Save() (rowsAffected int64) {
	result := database.DB.Save(&region)
	return result.RowsAffected
}

func (region *Region) Delete() (rowsAffected int64) {
	result := database.DB.Delete(&region)
	return result.RowsAffected
}
